package com.sluggard.ai.config;

/**
 * 类描述：
 *
 * @author lizheng
 * @created 2025/4/24 15:23
 */

import io.modelcontextprotocol.client.McpAsyncClient;
import io.modelcontextprotocol.client.McpClient;
import io.modelcontextprotocol.client.transport.ServerParameters;
import io.modelcontextprotocol.client.transport.StdioClientTransport;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.time.Duration;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    private final AsyncTaskExecutor asyncTaskExecutor;

    public WebMvcConfig(@Qualifier("asyncTaskExecutor") AsyncTaskExecutor asyncTaskExecutor) {
        this.asyncTaskExecutor = asyncTaskExecutor;
    }

    @Override
    public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
        // 设置异步任务执行器
        configurer.setTaskExecutor(asyncTaskExecutor);
        // 设置异步请求超时时间（毫秒）
        configurer.setDefaultTimeout(120_000);
    }
}
